﻿using System.ServiceModel;
using System.ServiceModel.Channels;

namespace GoogleAPI.UrlShortener
{
    /// <summary>
    /// A URL Resource is a grouping of a pair of short and long URLs, along with their properties. 
    /// There is a single URL Collection, representing the set of all goo.gl short URLs, so you cannot 
    /// list the entire collection. When making requests on behalf of an authenticated account, however, 
    /// you can list those resources that were created with that account.
    ///
    /// Available methods are:
    ///
    /// •url.insert - Creates a new short URL.
    /// •url.get - Expands a short URL or gets creation time and analytics.
    /// •url.list - Gets a user's history of shortened URLs.
    /// </summary>
    public partial class UrlResource :
    ClientBase<IUrlShortenerService>, IUrlShortenerService
    {
        public UrlResource()
        {
        }

        public UrlResource(string endpointConfigurationName) :
            base(endpointConfigurationName)
        {
        }

        public UrlResource(
         string endpointConfigurationName,
        string remoteAddress) :
            base(endpointConfigurationName, remoteAddress)
        {
        }

        public UrlResource(string endpointConfigurationName,
        EndpointAddress remoteAddress) :
            base(endpointConfigurationName, remoteAddress)
        {
        }

        public UrlResource(Binding binding,
        EndpointAddress remoteAddress) :
            base(binding, remoteAddress)
        {
        }

        /// <summary>
        /// The url.insert method creates a new short URL. 
        ///
        /// Authentication is optional for the url.insert method. If an authentication token with access to 
        /// https://www.googleapis.com/auth/urlshortener is provided, the method creates a short URL 
        /// for the authenticated user. The short URL created will appear in the authenticated user's list 
        /// method results and on their dashboard at http://goo.gl/. If no authentication is provided, the 
        /// short URL that the method creates is not associated with any particular account.
        ///
        /// When creating a new short URL, you must supply a URL Resource as the message body. 
        /// Note that for a new short URL, only the longUrl property is required
        /// </summary>
        /// <param name="key">Your API key (using the key query parameter). </param>
        /// <param name="request">Parameters request, as LongUrl.</param>
        /// <returns>
        ///  "kind": "urlshortener#url",  
        ///  "id": value,  
        ///  "longUrl": value, 
        /// </returns>
        public ExpandResponse Insert(string key, ShortenRequest request)
        {
            return base.Channel.Insert(key, request);
        }

        /// <summary>
        /// The url.insert method creates a new short URL. 
        ///
        /// Authentication is optional for the url.insert method. If an authentication token with access to 
        /// https://www.googleapis.com/auth/urlshortener is provided, the method creates a short URL 
        /// for the authenticated user. The short URL created will appear in the authenticated user's list 
        /// method results and on their dashboard at http://goo.gl/. If no authentication is provided, the 
        /// short URL that the method creates is not associated with any particular account.
        ///
        /// When creating a new short URL, you must supply a URL Resource as the message body. 
        /// Note that for a new short URL, only the longUrl property is required
        /// 
        /// Note: You can omit the key parameter when making a limited number of calls, such as during the testing phase.
        /// </summary>
        /// <param name="request">Parameters request, as LongUrl.</param>
        /// <returns>
        ///  "kind": "urlshortener#url",  
        ///  "id": value,  
        ///  "longUrl": value, 
        /// </returns>
        public ExpandResponse Insert(ShortenRequest request)
        {
            return base.Channel.Insert(request);
        }

        /// <summary>
        /// The url.get method gets expansion information for a specified short URL. 
        ///
        /// For the given short URL, the url.get method returns the corresponding long URL and the status.
        /// </summary>
        /// <param name="key">Your API key (using the key query parameter). </param>
        /// <param name="shortUrl">
        /// The short URL (using the shortUrl query parameter). 
        /// Note: The short URL should include the protocol, e.g. "http://goo.gl/fbsS".
        /// </param>
        /// <returns>
        /// "kind": "urlshortener#url",  
        /// "id": value,  
        /// "longUrl": value,  
        /// "status": value, 
        /// </returns>
        public ExpandResponse Get(string key, string shortUrl)
        {            
            return base.Channel.Get(key, shortUrl);
        }

        /// <summary>
        /// The url.get method gets expansion information for a specified short URL. 
        ///
        /// For the given short URL, the url.get method returns the corresponding long URL and the status.
        /// 
        ///  Note: You can omit the key parameter when making a limited number of calls, such as during the testing phase.
        /// </summary>
        /// <param name="shortUrl">
        /// The short URL (using the shortUrl query parameter). 
        /// Note: The short URL should include the protocol, e.g. "http://goo.gl/fbsS".
        /// </param>
        /// <returns>
        /// "kind": "urlshortener#url",  
        /// "id": value,  
        /// "longUrl": value,  
        /// "status": value, 
        /// </returns>
        public ExpandResponse Get(string shortUrl)
        {
            return base.Channel.Get(shortUrl);
        }

        /// <summary>
        /// The url.get method gets expansion information for a specified short URL. 
        ///
        /// For the given short URL, the url.get method returns the corresponding long URL and the status.
        /// </summary>
        /// <param name="key">Your API key (using the key query parameter). </param>
        /// <param name="shortUrl">
        /// The short URL (using the shortUrl query parameter). 
        /// Note: The short URL should include the protocol, e.g. "http://goo.gl/fbsS".
        /// </param>
        /// <param name="projection">
        /// Note: Default Value is FULL
        /// 
        /// •Additional information to return (using the projection query parameter). Possible values are:
        ///     ◦"FULL" - returns the creation timestamp and all available analytics
        ///     ◦"ANALYTICS_CLICKS" - returns only click counts
        ///     ◦"ANALYTICS_TOP_STRINGS" - returns only top string counts (e.g. referrers, countries, etc)
        /// 
        /// Note that with the projection parameter, analytics might not be returned if data is currently unavailable.
        /// </param>
        /// <returns>
        /// {  "kind": "urlshortener#url",  
        /// "id": value,  "longUrl": value,  
        /// "status": value,  
        /// "created": value,  
        /// "analytics": {    
        ///     "allTime": {      
        ///         "shortUrlClicks": value,      
        ///         "longUrlClicks": value,      
        ///         "referrers": [        {          
        ///             "count": value,          
        ///             "id": value        }, ...      ],      
        ///         "countries": [ ... ],      
        ///         "browsers": [ ... ],      
        ///         "platforms": [ ... ]    },    
        ///     "month": { ... },    
        ///     "week": { ... },    
        ///     "day": { ... },    
        ///     "twoHours": { ... }  }}
        /// </returns>
        public ExpandResponse GetWithProjection(string key, string shortUrl, string projection = "FULL")
        {
            return base.Channel.GetWithProjection(key, shortUrl, projection);
        }

        /// <summary>
        /// The url.get method gets expansion information for a specified short URL. 
        ///
        /// For the given short URL, the url.get method returns the corresponding long URL and the status.
        /// 
        ///  Note: You can omit the key parameter when making a limited number of calls, such as during the testing phase.
        /// <param name="shortUrl">
        /// The short URL (using the shortUrl query parameter). 
        /// Note: The short URL should include the protocol, e.g. "http://goo.gl/fbsS".
        /// </param>
        /// <param name="projection">
        /// Note: Default Value is FULL
        /// 
        /// •Additional information to return (using the projection query parameter). Possible values are:
        ///     ◦"FULL" - returns the creation timestamp and all available analytics
        ///     ◦"ANALYTICS_CLICKS" - returns only click counts
        ///     ◦"ANALYTICS_TOP_STRINGS" - returns only top string counts (e.g. referrers, countries, etc)
        /// 
        /// Note that with the projection parameter, analytics might not be returned if data is currently unavailable.
        /// </param>
        /// <returns>
        /// {  "kind": "urlshortener#url",  
        /// "id": value,  "longUrl": value,  
        /// "status": value,  
        /// "created": value,  
        /// "analytics": {    
        ///     "allTime": {      
        ///         "shortUrlClicks": value,      
        ///         "longUrlClicks": value,      
        ///         "referrers": [        {          
        ///             "count": value,          
        ///             "id": value        }, ...      ],      
        ///         "countries": [ ... ],      
        ///         "browsers": [ ... ],      
        ///         "platforms": [ ... ]    },    
        ///     "month": { ... },    
        ///     "week": { ... },    
        ///     "day": { ... },    
        ///     "twoHours": { ... }  }}
        /// </returns>
        public ExpandResponse GetWithProjection(string shortUrl, string projection = "FULL")
        {
            return base.Channel.GetWithProjection(shortUrl, projection);
        }

        /// <summary>
        /// The url.list method retrieves a list of URLs shortened by the authenticated user. Authentication is required. 
        ///
        /// The url.list method returns a paginated list of information about short URLs created by a user, 
        /// sorted in reverse chronological order. Each returned resource contains the short URL, long URL, 
        /// creation timestamp, and status.
        /// </summary>
        /// <param name="key">Your API key (using the key query parameter). </param>
        /// <returns>
        /// {  "kind": "urlshortener#urlHistory",  
        /// "totalItems": value,  
        /// "itemsPerPage": value,  
        /// "nextPageToken": value,  
        /// "items": [    
        ///     URL Resource  ]}
        /// </returns>
        public HistoryResponse List(string key)
        {
            return base.Channel.List(key);
        }

        /// <summary>
        /// The url.list method retrieves a list of URLs shortened by the authenticated user. Authentication is required. 
        ///
        /// The url.list method returns a paginated list of information about short URLs created by a user, 
        /// sorted in reverse chronological order. Each returned resource contains the short URL, long URL, 
        /// creation timestamp, and status.
        /// </summary>
        /// <param name="key">Your API key (using the key query parameter). </param>
        /// <param name="startToken">
        /// The index into the paginated list (using the start-token query parameter). 
        /// To request successive pages of results, set the start-token parameter 
        /// to the current result's nextPageToken value
        /// </param>
        /// <returns>
        /// {  "kind": "urlshortener#urlHistory",  
        /// "totalItems": value,  
        /// "itemsPerPage": value,  
        /// "nextPageToken": value,  
        /// "items": [    
        ///     URL Resource  ]}
        /// </returns>
        public HistoryResponse ListWithStartToken(string key, string startToken)
        {
            return base.Channel.ListWithStartToken(key, startToken);
        }

        /// <summary>
        /// The url.list method retrieves a list of URLs shortened by the authenticated user. Authentication is required. 
        ///
        /// The url.list method returns a paginated list of information about short URLs created by a user, 
        /// sorted in reverse chronological order. Each returned resource contains the short URL, long URL, 
        /// creation timestamp, and status.
        /// </summary>
        /// <param name="key">Your API key (using the key query parameter). </param>
        /// <param name="projection">
        /// Additional information to return (using the projection query parameter). The only supported values are:
        ///     ◦"FULL" - returns short URL click counts (Default Value)
        ///     ◦"ANALYTICS_CLICKS" - returns short URL click counts
        /// </param>
        /// <returns>
        /// {  "kind": "urlshortener#urlHistory",  
        /// "totalItems": value,  
        /// "itemsPerPage": value,  
        /// "nextPageToken": value,  
        /// "items": [    
        ///     URL Resource  ]}
        /// </returns>
        public HistoryResponse ListWithProjection(string key, string projection = "FULL")
        {
            return base.Channel.ListWithProjection(key, projection);
        }

        /// <summary>
        /// The url.list method retrieves a list of URLs shortened by the authenticated user. Authentication is required. 
        ///
        /// The url.list method returns a paginated list of information about short URLs created by a user, 
        /// sorted in reverse chronological order. Each returned resource contains the short URL, long URL, 
        /// creation timestamp, and status.
        /// </summary>
        /// <param name="key">Your API key (using the key query parameter). </param>
        /// <param name="startToken">
        /// The index into the paginated list (using the start-token query parameter). 
        /// To request successive pages of results, set the start-token parameter 
        /// to the current result's nextPageToken value
        /// </param>
        /// <param name="projection">
        /// Additional information to return (using the projection query parameter). The only supported values are:
        ///     ◦"FULL" - returns short URL click counts (Default Value)
        ///     ◦"ANALYTICS_CLICKS" - returns short URL click counts
        /// </param>
        /// <returns>
        /// {  "kind": "urlshortener#urlHistory",  
        /// "totalItems": value,  
        /// "itemsPerPage": value,  
        /// "nextPageToken": value,  
        /// "items": [    
        ///     URL Resource  ]}
        /// </returns>
        public HistoryResponse ListWithStartTokenAndProjection(string key, string startToken, string projection = "FULL")
        {
            return base.Channel.ListWithStartTokenAndProjection(key, startToken, projection);
        }
    }

}
